import request from './apiConfig'
const base_url = '/departments'

export function listDeptTreeByQo(query) {
    return request({
        url: base_url+'/single/tree',
        method: 'GET',
        params: query,
    })
}

/**
 * 根据部门id获取部门信息
 * @param {*} id 
 */
export function getDeptById(id){
    return request({
        url: `${base_url}/${id}`,
        method:'GET',
    })
}
/**
 * 展示部门
 * @param {*} query 
 */
export function listDepartments(query) {
    return request({
        url: base_url,
        method: 'GET',
        params: query,
    })
}
/**
 * 插入部门
 * @param {*} dept 
 */
export function insertDeptApi(dept) {
    return request({
        url: base_url,
        method: 'POST',
        data: dept
    })
}
/**
 * 修改部门
 * @param {*} dept 
 */
export function mdfDeptApi(dept){
    return request({
        url:base_url,
        method:"PUT",
        data:dept
    })
}
/**
 * 删除单一部门
 * @param {*} id 
 */
export function delOneDeptApi(id) {
    return request({
        url: `${base_url}/${id}`,
        method: 'DELETE',
    })
}



// 部门树形结构
export function getDeptTreeApi(query) {
    return request({
        url: `${base_url}/tree`,
        method: 'GET',
        params: query,
    })
}